package com.jdwx.opengl.kotlin

open class Base(p: Int)
class Derived(p: Int) : Base(p)

open class Shape {
     open fun draw() { println( " draw1 " ) /*……*/ }
     fun fill() { /*……*/ }
}

class Circle() : Shape() {
    final override fun  draw() {  println( " draw2 " ) /*……*/ }
}

open class Rectangle {
    open fun draw() { println("Drawing a rectangle") }
    val borderColor: String get() = "black"
}

class FilledRectangle : Rectangle() {
    override fun draw() {
        super.draw()
        println("Filling the rectangle")
    }

    val fillColor: String get() = super.borderColor

    inner class Filler {
        fun fill() { /* …… */ }
        fun drawAndFill() {
            super@FilledRectangle.draw() // 调用 Rectangle 的 draw() 实现
            fill()
            draw()
            println("Drawn a filled rectangle with color ${super@FilledRectangle.borderColor}") // 使用 Rectangle 所实现的 borderColor 的 get()
        }
    }
}



fun main(){

    var c = Circle()
    c.draw()
    c.fill()

    var fr =  FilledRectangle()

    println( fr.fillColor )

    fr.Filler().drawAndFill()

}